//
//  NSString+TimeInterval.m
//  MyLittleBrother
//
//  Created by speeda on 17/8/7.
//  Copyright © 2017年 speeda. All rights reserved.
//

#import "NSString+TimeInterval.h"

@implementation NSString (TimeInterval)

+ (instancetype)timeWithTimeIntervalString:(NSString *)string {

    NSTimeInterval time = [string doubleValue];
    NSDate *detaildate = [NSDate dateWithTimeIntervalSince1970:time];
    //实例化一个NSDateFormatter对象
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    //设定时间格式,这里可以设置成自己需要的格式
    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    
    return [dateFormatter stringFromDate: detaildate];
}

@end
